<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>简单计算器</title>
</head>
<body>
    <script>
        let theFirstIsTheOperand = +prompt('请输入第一个被操作数');
        let operator  = prompt('请输入以下运算符：*/+-');
        let theSecondIsTheOperand = +prompt('请输入第二个被操作数');
        switch (operator) {
            case '+':
                alert(`${theFirstIsTheOperand}+${theSecondIsTheOperand}=${theFirstIsTheOperand+theSecondIsTheOperand}`);
                break;
            case '-':
                alert(`${theFirstIsTheOperand}-${theSecondIsTheOperand}=${theFirstIsTheOperand-theSecondIsTheOperand}`);
                break;
            case '*':
                alert(`${theFirstIsTheOperand}*${theSecondIsTheOperand}=${theFirstIsTheOperand*theSecondIsTheOperand}`);
                break;
            case '/':
                if(theSecondIsTheOperand !== 0){
                    alert(`${theFirstIsTheOperand}/${theSecondIsTheOperand}=${theFirstIsTheOperand/theSecondIsTheOperand}`);
                }
                else{
                    alert('操作不合法')
                }
                break;
            default:
                alert('目前无此功能');
                break;
        }
    </script>
</body>
</html>